package lcy.homework04.equals;

import java.util.Arrays;
import java.util.Date;

/**
 * @ClassName: PersonTest
 * @Description:
 * @author: 李春洋
 * @date: 2024/4/18 16:38
 * @Blog: https://
 */
public class PersonTest {
    public static void main(String[] args) {
        // 测试排序功能
        Person[] people = {
                new Person("爱丽丝", "110101200103231116", new Date(2001, 3, 23)),
                new Person("阿来", "110101201103241116", new Date(2011, 3, 24)),
                new Person("查理", "110101202103251116", new Date(2021, 3, 25))
        };
        Arrays.sort(people);
        System.out.println("按名称排序:");
        for (Person person : people) {
            System.out.println(person);
        }

        // 测试克隆功能
        Person originalPerson = new Person("爱丽丝", "110101200103231116", new Date(2001, 3, 23));
        Person clonedPerson = originalPerson.clone();
        System.out.println("复制前的人信息: " + originalPerson);
        System.out.println("克隆后的人信息: " + clonedPerson);
        System.out.println("是否相等? " + originalPerson.equals(clonedPerson));
    }
}
